package com.singzi.leetcode.jianzhiOffer;

import com.singzi.leetcode.obj.TreeNode;

public class T0028 {
}
class Solution0028 {
    public boolean isSymmetric(TreeNode root) {
        if(root==null) return true;

        return recurTree(root.left, root.right);

    }
    public boolean recurTree(TreeNode left, TreeNode right){
        if(left == null && right == null) return true;
        else if(left != null && right != null) return left.val == right.val
                && recurTree(left.left, right.right)
                && recurTree(right.left, left.right);
        else return false;
    }
}